home *** CD-ROM | disk | FTP | other *** search
- /* $Header: /Source/Media/drapeau/NetworkProtocol/RCS/auxFunctions.c,v 1.11 91/02/28 07:18:16 drapeau Exp Locker: drapeau $ */
- /* $Log: auxFunctions.c,v $
- * Revision 1.11 91/02/28 07:18:16 drapeau
- * No code changes; this version uses a new version numbering scheme and a new
- * version of RCS.
- *
- * Revision 1.1 90/10/24 18:28:54 drapeau
- * Initial revision
- * */
-
- static char auxFunctionsRcsid[] = "$Header: /Source/Media/drapeau/NetworkProtocol/RCS/auxFunctions.c,v 1.11 91/02/28 07:18:16 drapeau Exp Locker: drapeau $";
-
- #include <stdio.h>
- #include <string.h>
-
- char* strdup(char* theString)
- {
- char* tempString = NULL;
- int stringLength = 0;
-
- if (theString == NULL) /* Was the string passed in invalid? */
- return((char*)NULL); /* Yes, return NULL string */
- stringLength = strlen(theString); /* Get the length of the string passed in */
- tempString = (char*) malloc(stringLength + 1); /* Try to allocate space for a copy of the string passed in */
- if (tempString == NULL) /* Was th allocation unsuccessful? */
- return (char*)NULL; /* Yes, return a NULL string */
- strcpy(tempString,theString); /* Allocation successful, copy old string to new string */
- tempString[stringLength] = '\0'; /* Terminate new string */
- return(tempString); /* Return pointer to the new string */
- } /* end function strdup */
-
-